<%@ page import="njust.course.CourseDAO" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="njust.utils.DBUtil" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 25174
  Date: 2022/4/13
  Time: 22:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

</head>
<body>
<%
    List<Map<String, Object>> courses = DBUtil.query("course", null);
%>
<form action="CourseController">
<table border="1" width="600" id = "courseT">
    <tr>
        <td align = "center"></td>
        <td align = "center">序号</td>
        <td align = "center">课程名称</td>
        <td align = "center">选课人数</td>
        <td align = "center">课程性质</td>
    </tr>
        <%
        for(Map<String, Object> course:courses){
    %>
    <tr>
        <td align = "center"><input name="courseId" type="checkbox" value=<%=course.get("cId") +""%> ></td>
        <td align = "center"><%=course.get("cId")%></td>
        <td align = "center"><%=course.get("cName") %></td>
        <td align = "center"><%=course.get("cNum") %></td>
        <td align = "center"><%=course.get("cType") %></td>
    </tr>
        <%
    }
%>
    <input type="hidden" name="courseFormCheck" value="delCourse">
</table>
    <br>
    <input type="submit" value="删除">
</form>
<br>
<input type="hidden" name="message" value="<%=request.getAttribute("message") %>">
<%
    String message = (String) request.getAttribute("message");
    if (message!=null){
        out.println("删除成功");
        request.setAttribute("message",null);
        %>
    <a href="allCourse.jsp" >点此返回</a>
<%
    }
%>

</body>
</html>
